Video encoding is used for reducing the size, in terms of bytes, of a video sequence at the expense of a reduced image quality. In e.g. video telephony, a video sequence may be encoded in a real-time video encoder in a transmitter, e.g. in accordance with the MPEG4, H.263, or H.264 standard. The encoded video sequence may in turn be transmitted over a wired or wireless communication channel with a limited bandwidth to a receiver. In such an application, the average bit rate of the encoded video sequence must not be larger than the bandwidth of the communication channel. Further, in order for a user of the receiver to perceive a reasonable video quality, it is important that the bit rate of the encoded video sequence is constant or nearly constant. In other words, the size of each encoded video frame should be approximately the same. If the bit rate of the encoded video sequence oscillates, the user of the receiver will experience undesired artifacts. For example, the user may experience a long end-to-end delay or jitter between the video frames. The perceived video frame rate may be lower than the actual average video frame rate if the time intervals between displayed video frames are irregular.
An oscillating bit rate of the encoded video stream may, in principle, be compensated for by introducing a buffer in the receiver. Then, the received encoded video sequence may be delayed in the receiver and the video frames may be presented at a constant video frame rate, e.g. on a display of the receiver, even if the video frames are received at a variable rate. However, in a two-way communication scenario, such as video telephony, the introduction of a delay is highly undesirable and may be a source of annoyance for the users. For this reason, it is also important to have a short latency in the video encoder. Otherwise, the users will also experience an undesired delay in the communication.
A quantization parameter (QP) is a parameter that determines the degree of compression of an encoded video frame; a smaller QP results in a better image quality and a larger size, whereas a larger QP results in worse image quality and a smaller size. However, the resulting size of the encoded video frame is not only dependent on the QP, but may also depend on e.g. the contents (e.g., pixel data such as luminance and chrominance data) of the video frame and previous video frames. For example, for a fixed QP value, if there is a large difference between the contents of the video frame and the previous video frame, e.g. due to a large amount of motion of objects in the video frame, the resulting size of the encoded video frame is normally larger than if there is only a small difference between the contents of the video frame and the previous video frame.
In order to reduce bit-rate oscillations in the encoded video sequence, a rate-control algorithm is normally used. Rate control is normally achieved by dynamically varying the QP during the encoding. For example, a video frame may be divided into a plurality of macro blocks having, e.g., 16×16 pixels. During the encoding of a video frame, the QP value may be dynamically varied between each macro block, e.g. based on the sizes of previously encoded macro blocks, in order to control the bit rate. Such an approach for controlling the bit rate allows for a short latency in the video encoder. However, known bit-rate control algorithms of this type causes high bit-rate oscillations.
In a multi-pass video encoding scheme, each video frame may be encoded more than once with different QP values in order to reach a desired bit rate. Multi-pass video encoding may result in lower bit-rate oscillations compared with encoding each video frame only once, such as described in the publication: WESTERINK P H et al: “Two-pass MPEG-2 variable-bit-rate encoding” IBM J. RES. DEVELOP., vol. 43, no. 4, 4 Jul. 1999 (1999-07-04), pages 471-488, XP002395114. However, known multi-pass video encoders suffer from long latency, which is undesired in a video encoder for e.g. video telephony.